<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String username = user.getName();
	String siteid = user.getSiteId();
	List<TblOaAuthPermission> permissionlist = (List<TblOaAuthPermission>)request.getAttribute("rolepermissionlistList");
%>

<style>
	.selectHour-split{
		padding:0 2px;
		margin-right:5px;	
	}
	.selectMinute-split{
		padding:0 2px;
	}
</style>

<div>
	<form id="LeaveAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/check/doAddRole" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>新增角色</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">所属公司：</td>
				<td>
					<select id="siteList" class="easyui-combobox" name="siteid" style="width:100px;"></select>
					<span class="errorTipWrap" id="errorTip_siteid"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">角色名称:</td>
				<td><input class="inputText xxs" value="默认角色" name="rolename"></td>
			</tr>
			<tr>
				<td class="tdTitle">权限：</td>
				<td class="" colspan="2">
					<div style="padding-top:10px;padding-bottom:10px;">
						<div class="checkbox-wrap">
							<label>
								<input type="checkbox" class="checkbox checkboxSelectAll">
								<span>全选</span>
							</label>
						</div>
						<div class="checkbox-wrap">
						<%
							if(!CollectionUtils.isEmpty(permissionlist)){
								for(TblOaAuthPermission p :permissionlist){
									%>
										<label class="check-label-role">
											<input type="checkbox"
											 value="<%=EncrypTool.encode(p.getPermissionId()+"")%>" 
											 name="permissioins" 
											 class="checkbox">
											<span><%=p.getPermissionName() %></span>
										</label>
									<%
								}
							}
						%>
						</div>
					</div>
				</td>
			</tr>
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Setting.listRole()">取消</a>
					</div>
				</td>
			</tr>	
		</table>
		<input type="hidden" value="<%=username %>" name="addUser"> 	
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<script>
$('#siteList').combobox({
	url:global.contextPath + '/company/siteList',
	valueField:'siteid',
	textField:'sitename',
});

XF.Check.init();
XF.Setting.initAddRole();
</script>


